﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace LTHD_Web
{
    public partial class Postcomment : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int placeid = int.Parse(Request["cid"]); // courses id 
            int accid = int.Parse(Request["aid"]); //account id 
            int commentid = int.Parse(Request["mid"]); //comment id

            string content = Request["text"];



            dbDataContext db = new dbDataContext();
            comment info = new comment();
            info.diadiem = placeid;
            info.taikhoan = accid;
            info.date = DateTime.Now.ToString("yyyy MMMM dd") + " at " + DateTime.Now.ToString(" hh:mm") + DateTime.Now.ToString("tt").ToLower();
            if (commentid != -1)
                info.commentid = commentid;
            info.noidung = content;

            db.comments.InsertOnSubmit(info);
            db.SubmitChanges();
        }
    }
}